package com.reviling.filamentandroid

import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.SurfaceView

class MineSurfaceView : SurfaceView {
    constructor(context: Context?) : super(context)
    constructor(context: Context?, attributeSet: AttributeSet?) : super(context, attributeSet)
    constructor(context: Context?, attributeSet: AttributeSet?, i: Int) : super(
        context,
        attributeSet,
        i
    )

    constructor(context: Context?, attributeSet: AttributeSet?, i: Int, i2: Int) : super(
        context,
        attributeSet,
        i,
        i2
    )

    override fun dispatchTouchEvent(motionEvent: MotionEvent): Boolean {
        parent.requestDisallowInterceptTouchEvent(true)
        return super.dispatchTouchEvent(motionEvent)
    }

    override fun onTouchEvent(motionEvent: MotionEvent): Boolean {
        if (motionEvent.action != 0) {
            return false
        }
        parent.requestDisallowInterceptTouchEvent(true)
        return super.onTouchEvent(motionEvent)
    }
}